import request from "@/utils/request";
import getUrlParameter from "@/utils/urlparameter";
/**
 * 高压系统
 */
// 获取人员列表
export const getMenbers = async (data = {}) => {
    return await request.get("/modbus-api/personnelManagement/findAllPersonnelManagement", data).then((res) => {
        return res;
    });
};
// // 获取定位器坐标
// export const getOption = async (data = {}) => {
//     return await request.get("/device/option", data).then((res) => {
//         return res;
//     });
// };
// 添加人员
export const addMenber = async (data = {}) => {
    return await request.post("/modbus-api/personnelManagement/addPersonnelManagement", data).then((res) => {
        return res;
    });
};
// 修改人员
export const updateMenber = async (data = {}) => {
    return await request.post("/modbus-api/personnelManagement/editPersonnelManagement", data).then((res) => {
        return res;
    });
};
// 删除人员
export const removeMenber = async (data = {}) => {
    return await request.postForm("/modbus-api/personnelManagement/removePersonnelManagement", data).then((res) => {
        return res;
    });
};
// 获取设备列表
export const getDeviceList = async (data = {}) => {
    return await request.get("/modbus-api/equipment/findAllEquipment", data).then((res) => {
        return res;
    });
};

// 添加设备坐标数据
export const setLocation = async (data = {}) => {
    return await request.post("/modbus-api/equipmentLocation/addeQuipmentLocation", data).then((res) => {
        return res;
    });
};
// 添加设备坐标数据
export const getLocation = async (id: any, deviceId: any) => {
    return await request.get(`/modbus-api/equipmentLocation/findEquipmentLocationsByDeviceId?personnelId=${id}&deviceId=${deviceId}`).then((res) => {
        // console.log(res);
        return res;
    });
};
/**
 * 喷灌系统
 */
/**
 * 滴灌系统
 */
/**
 * 公用接口
 */

// 获取所有的滴灌喷灌分区地图标绘数据
export const getAllSubareaData = async (data = {}) => {
    return await request.get("/modbus-api/dgfq/findAllDgfq", data).then((res) => {
        return res;
    });
};
// 获取所有的滴灌喷灌主管道标绘数据
export const getAllSubareaPipeNetwork = async (data = {}) => {
    return await request.get("/modbus-api/dgpgzgdInfo/findAllDgpgzgdInfo", data).then((res) => {
        return res;
    });
};
// 获取所有的滴灌喷灌管网标绘数据
export const getAllPipeNetwork = async (data = {}) => {
    return await request.get("/modbus-api/gygdInfo/findAllGygdInfo", data).then((res) => {
        return res;
    });
};
// 获取所有的滴灌喷灌分区列表
export const getAllSubareaList = async (type: string | number) => {
    return await request.get(`/modbus-api/dripIrrigationStatisticsInfo/findAllDripIrrigationStatisticsInfo?type=${type}&jfDeviceId=${getUrlParameter("id")}`).then((res) => {
        return res;
    });
};

// 修改滴灌喷灌分区参数
export const updateSubareaMsg = async (data = {}) => {
    return await request.postForm("/modbus-api/dripIrrigationStatisticsInfo/editDripIrrigationStatisticsInfo", data).then((res) => {
        return res;
    });
};
// 滴灌喷灌分区开始--t停止作业
export const startOrEndDoing = async (data = {}) => {
    return await request.post("/modbus-api/deviceOperate/sendControl", data).then((res) => {
        return res;
    });
};
/**
 * 公用组件
 */

// 获取运行参数
export const getProcessParameter = async (id: string) => {
    return await request.get(`/modbus-api/deviceOperate/getReceiveMsgByUid?deviceId=${id}`).then((res) => {
        return res;
    });
};
